﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="RolesPage.aspx.cs" Inherits="RGPWEB.admin.Modubles.RolesPage" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <link href="../../inc/Style/index.css" rel="stylesheet" type="text/css" />
    <link href="../../inc/Style/childindex.css" rel="stylesheet" type="text/css" />
    <link href="../../inc/Style/GridView.css" rel="stylesheet" type="text/css" />

    <script src="../../../Inc/Script/pub.js" type="text/javascript"></script>

    <script type="text/javascript">

        //新增数据合法性检测
        function CheckAdd() {
            var ret = true;

            if ($id("GroupList").value == "all") {
                alert('请输选择角色分组!');
                ret = false;
            }
            else if ($id("txt_name").value == "") {
                alert('请输入名称!');
                ret = false;
            } else if ($id("txt_order").value == "") {
                alert('请输入排序编号');
                ret = false;
            }
            return ret;
        }
        
    </script>

</head>
<body>
    <form id="form1" runat="server">
    <asp:Panel ID="TitlePanel" runat="server" CssClass="titlePadding">
        角色管理
    </asp:Panel>
    <asp:Panel ID="ChildPanel" runat="server" Style="width: 700px;">
        <div class="rowdiv" style="margin-left: 3px;">
            分组：</div>
        <div class="rowdiv" style="margin-left: 3px;">
            <asp:DropDownList ID="GroupList" runat="server" AutoPostBack="True" OnSelectedIndexChanged="GroupList_SelectedIndexChanged">
            </asp:DropDownList>
        </div>
        <div runat="server" id="addpanel" class="rowdiv">
            <div class="rowdiv" style="margin-left: 3px;">
                名称：</div>
            <div class="rowdiv">
                <asp:TextBox ID="txt_Name" Width="120" MaxLength="30" CssClass="inputbox" runat="server"></asp:TextBox></div>
            <div class="rowdiv" style="margin-left: 3px;">
                说明：</div>
            <div class="rowdiv" style="margin-left: 3px;">
                <asp:TextBox ID="txt_Description" CssClass="inputbox" runat="server"></asp:TextBox>
            </div>
            <div class="rowdiv" style="margin-left: 3px;">
                排序：</div>
            <div class="rowdiv" style="margin-left: 3px;">
                <asp:TextBox ID="txt_order" CssClass="inputbox" Width="30px" runat="server" onkeypress="return event.keyCode>=48&&event.keyCode<=57"
                    onpaste="return !clipboardData.getData('text').match(/\D/)"></asp:TextBox>
            </div>
            <div class="rowdiv" style="margin-left: 5px; line-height: 30px;">
                <asp:Button ID="btn_add" CssClass="smallbtn" runat="server" Text="新增" OnClick="btn_add_Click" /></div>
        </div>
    </asp:Panel>
    <div id="strinfo" runat="server" class="mbox pbox" visible="false">
    </div>
    <div class="gv">
        <asp:GridView ID="RolesLists" runat="server" DataKeyNames="RoleID" CssClass="Grid"
            AllowSorting="True" OnRowCommand="RolesLists_RowCommand" OnRowDataBound="RolesLists_RowDataBound"
            AllowPaging="True" OnPageIndexChanging="RolesLists_PageIndexChanging" PageSize="15"
            AutoGenerateColumns="False" OnRowCancelingEdit="RolesLists_RowCancelingEdit"
            OnRowEditing="RolesLists_RowEditing" OnRowUpdating="RolesLists_RowUpdating">
            <FooterStyle CssClass="GridFooter" />
            <RowStyle CssClass="Row" />
            <Columns>
                <asp:BoundField DataField="RoleID" HeaderText="编号" ReadOnly="True">
                    <HeaderStyle HorizontalAlign="Left" Wrap="False" />
                    <ItemStyle HorizontalAlign="Center" Wrap="false" />
                </asp:BoundField>
                <asp:TemplateField HeaderText="名称">
                    <ItemTemplate>
                        <asp:Label ID="Lab_name" runat="server" Text='<%# Eval("RoleName") %>'></asp:Label>
                    </ItemTemplate>
                    <EditItemTemplate>
                        <asp:TextBox ID="txt_name" Width="120" MaxLength="30" CssClass="inputbox" runat="server"
                            Text='<%# Eval("RoleName") %>'></asp:TextBox>
                    </EditItemTemplate>
                    <HeaderStyle HorizontalAlign="Left" Wrap="False" />
                    <ItemStyle HorizontalAlign="Left" Wrap="False" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="说明">
                    <ItemTemplate>
                        <asp:Label ID="Lab_Description" runat="server" Text='<%# Eval("RoleDescription") %>'></asp:Label>
                    </ItemTemplate>
                    <EditItemTemplate>
                        <asp:TextBox ID="txt_Description" Width="120" MaxLength="30" CssClass="inputbox"
                            runat="server" Text='<%# Eval("RoleDescription") %>'></asp:TextBox>
                    </EditItemTemplate>
                    <HeaderStyle HorizontalAlign="Left" Wrap="False" />
                    <ItemStyle HorizontalAlign="Left" Wrap="False" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="分组">
                    <ItemTemplate>
                        <asp:Label ID="Lab_GroupID" runat="server" Text='<%# Eval("RoleGroupID") %>'></asp:Label>
                        <asp:Label ID="hid_GroupID" runat="server" Text='<%# Eval("RoleGroupID") %>' Style="display: none;"></asp:Label>
                    </ItemTemplate>
                    <EditItemTemplate>
                        <asp:Label ID="Lab_GroupID" runat="server" Text='<%# Eval("RoleGroupID") %>' Style="display: none;"></asp:Label>
                        <asp:Label ID="hid_GroupID" runat="server" Text='<%# Eval("RoleGroupID") %>' Style="display: none;"></asp:Label>
                        <asp:DropDownList ID="GroupID" runat="server">
                        </asp:DropDownList>
                    </EditItemTemplate>
                    <HeaderStyle HorizontalAlign="Left" Wrap="False" />
                    <ItemStyle HorizontalAlign="Left" Wrap="False" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="排序">
                    <ItemTemplate>
                        <asp:Label ID="lab_order" runat="server" Text='<%# Eval("RoleOrder") %>'></asp:Label>
                    </ItemTemplate>
                    <EditItemTemplate>
                        <asp:TextBox ID="txt_order" Width="30" MaxLength="3" CssClass="inputbox" onkeypress="return event.keyCode>=48&&event.keyCode<=57"
                            onpaste="return !clipboardData.getData('text').match(/\D/)" runat="server" Text='<%# Eval("RoleOrder") %>'></asp:TextBox>
                    </EditItemTemplate>
                    <ItemStyle HorizontalAlign="Center" Wrap="False" />
                    <HeaderStyle HorizontalAlign="Center" Wrap="false" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="编辑" ShowHeader="False">
                    <ItemTemplate>
                        <asp:LinkButton ID="btn_Edit" runat="server" CausesValidation="False" CommandName="Edit"
                            Text="编辑" CommandArgument='<%# Eval("RoleID")%>'></asp:LinkButton>
                    </ItemTemplate>
                    <EditItemTemplate>
                        <asp:LinkButton ID="btn_update" runat="server" CausesValidation="True" CommandName="Update"
                            Text="更新"></asp:LinkButton>
                        &nbsp;<asp:LinkButton ID="btn_cancel" runat="server" CausesValidation="False" CommandName="Cancel"
                            Text="取消"></asp:LinkButton>
                    </EditItemTemplate>
                    <HeaderStyle HorizontalAlign="Left" Wrap="False" />
                    <ItemStyle HorizontalAlign="Center" Wrap="False" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="删除" ShowHeader="False">
                    <ItemTemplate>
                        <asp:LinkButton ID="btn_del" runat="server" CausesValidation="False" CommandName="Del"
                            Text="删除" CommandArgument='<%# Eval("RoleID")%>'></asp:LinkButton>
                    </ItemTemplate>
                    <HeaderStyle HorizontalAlign="Left" Wrap="False" />
                    <ItemStyle HorizontalAlign="Center" Wrap="False" />
                </asp:TemplateField>
            </Columns>
            <HeaderStyle CssClass="HeadingCell" />
            <AlternatingRowStyle BorderStyle="None" CssClass="AlternatingRow" />
        </asp:GridView>
        <div id="GridViewMsg" style="padding: 5px;" runat="server">
        </div>
    </div>
    </form>
</body>
</html>
